#coding:utf-8
from django.http import HttpResponse
from django.shortcuts import render_to_response
from django.template import loader, Context, Template
import urllib
import sys
sys.path.append("D:\\mysite\\wechat")
import oa2


def first_page(request):
    return HttpResponse("<p>世界好</p>")
    
def oa_list(request):
    name = 'xxxxxx'
    passwd = 'xxxxxx'
    oaName = 'xxxxxx'
    Yang = oa2.Oa(name, passwd, oaName)
    oalist = Yang.getMail()
    #return render_to_response('oalist.html', {'oalist': oalist})
    return HttpResponse(oalist)
    
def oa_content(request):
    #获取完整的访问地址
    offset = request.get_full_path()
    offset = offset.replace('/oa/*/', '')
    print 'offset is :', offset
    name = 'xxxxxx'
    passwd = 'xxxxxx'
    oaName = 'xxxxxx'
    Yang = oa2.Oa(name, passwd, oaName)
    mCont = Yang.getMailCont(offset)
    return HttpResponse(mCont)
        